package imnu.work.imnu0717_work05.work_3.oop;

/**
 * @author: lys
 * @类名: Rectangle
 * @Title:
 * @date: 2020/7/17
 **/
public class Rectangle extends Shape {
    //定义属性
    private double Width;
    private double height;
    //构造方法
    public Rectangle() {
    }
    public Rectangle(String color, double Width, double height) {
        super(color);
        this.Width = Width;
        this.height = height;
    }

    //重写方法
    @Override
    public void showAll() {
        System.out.println("面积："+String.format("%.2f",area)+"\t周长："+String.format("%.2f",per)+"\t颜色："+color);
    }

    @Override
    public void getArea() {
        area = Width*height;
    }

    @Override
    public void getPer() {
        per = (Width+height)*2;
    }
}
